
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>佰林の预定信息</title>
    <link rel="stylesheet" href="/common/layui/css/layui.css">
    <link rel="stylesheet" href="/admin/css/style.css">
    <script src="/common/layui/layui.js"></script>
    <script src="/common/jquery-3.3.1.min.js"></script>
    <script src="/common/vue.min.js"></script>
</head>
<body>
    <div class="main" id="app">
<!--        左侧数据-->
        <div id="fixedData">
            <!--顶栏-->
            <header>
                <h1 v-text="webname"></h1>
                <div class="breadcrumb">
                    <i class="layui-icon">&#xe715;</i>
                    <ul>
                        <li v-for="vo in address">
                            <a  v-text="vo.name" :href="vo.url" ></a> <span>/</span>
                        </li>
                    </ul>
                </div>
                <a>预定餐位</a>
            </header>
            <!--左栏-->
            <div class="left">
                <ul class="cl" >
                    <!--顶级分类-->
                    <li v-for="vo,index in menu" :class="{hidden:vo.hidden}">
                        <a href="javascript:;"  :class="{active:vo.active}"  @click="onActive(index)">
                            <i class="layui-icon" v-html="vo.icon"></i>
                            <span v-text="vo.name"></span>
                            <i class="layui-icon arrow" v-show="vo.url.length==0">&#xe61a;</i> <i v-show="vo.active" class="layui-icon active">&#xe623;</i>
                        </a>
                        <!--子级分类-->
                        <div v-for="vo2,index2 in vo.list">
                            <a href="javascript:;" :class="{active:vo2.active}" @click="onActive(index,index2)" v-text="vo2.name"></a>
                            <i v-show="vo2.active" class="layui-icon active">&#xe623;</i>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
        <!--右侧-->
        <div class="right" id="Right">
            <div class="layui-row">
                <div  class="layui-col-lg4 layui-col-md-offset8" style="text-align: right">

                    <div class="layui-input-inline" style="width: 300px">
                        <input type="text" name="k" value="" placeholder="餐位类型" class="layui-input key">
                    </div>
                    <button type="button" class="layui-btn sou">搜索</button>
                </div>
            </div>

            <table class="layui-table layui-form">

                <thead>
                <tr>
                    <th><a href="?/admin/user/index/order/uid.html">序号</a></th>
                    <th>UUID</th>
                    <th>可预约时间段</th>
                    <th>餐位类型</th>
                    <th>餐位号码</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr class="id36567" v-for="(item,index) of reserveList" :key="index" >
                    <td>{{index+1}}</td>
                    <td>{{item.id}}</td>
                    <td>{{item.reserveTime}}</td>
                    <td>{{item.roomType}}</td>
                    <td>{{item.tableNum}}</td>
                    <td>
                        <button class="layui-btn  layui-btn-xs layui-btn-danger" @click="reserve(item.id)">预约</button>
                    </td>
                </tr>

                </tbody>
            </table>
    </div>
<script src="/admin/js/config_user.js"></script>
<!--<script src="/admin/js/script.js"></script>-->
<script>
    let right = new Vue({
        el:'#Right',
        data: {
            reserveList:[],
            commodityType:[],
            status:0,
            activePage:1,

        },
        methods:{

            //获取可预约餐位信息
            getReserve(activePage,status){
                $.ajax({
                    url:'reserve/select',
                    type:'post',
                    data:JSON.stringify({
                        status:status
                    }),
                    contentType: "application/json;charset=UTF-8",
                    success: (data)=> {
                        // console.log(data,'data')
                        this.reserveList = data;
                    }
                })
            },
            //预定
            reserve(id){
                    $.ajax({
                        url:'reserve/updateAdd',
                        type:'post',
                        data:JSON.stringify({
                            id:id,
                            userId:JSON.parse( window.localStorage.getItem('userInfo')).username,
                            realName:JSON.parse( window.localStorage.getItem('userInfo')).realName,
                            phone:JSON.parse( window.localStorage.getItem('userInfo')).phone
                        }),
                        contentType: "application/json;charset=UTF-8",
                        success: (data)=> {
                            window.alert("预订成功！")
                            this.getReserve(this.activePage,0)
                        }
                    })
            },
        },
        mounted(){
            this.getReserve(this.activePage,0)
        },
    })
</script>
</body>
</html>
